Skip to content

Conversation

@jdonszelmann
Copy link
Contributor

@jdonszelmann jdonszelmann commented Nov 29, 2025

@rustbot
Copy link
Collaborator

rustbot commented Nov 29, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 29, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@jdonszelmann
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 29, 2025
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 29, 2025
@jdonszelmann
Copy link
Contributor Author

cc: @oli-obk this is what I was talking about. not yet clean, but wanted to see what perf looked like :3

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 29, 2025

💔 Test for 694a8a4 failed: CI. Failed jobs:

@jdonszelmann
Copy link
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 29, 2025
@rust-bors
Copy link

rust-bors bot commented Nov 29, 2025

☀️ Try build successful (CI)
Build commit: 7ac6e1b (7ac6e1b480efa4bd33f86547b8e73a2122f069d0, parent: 8a3a6bdb68b4d4c9ed922840808b02015741331e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7ac6e1b): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.4%, -0.2%] 8
Improvements ✅
(secondary)
-0.4% [-1.4%, -0.1%] 32
All ❌✅ (primary) -0.2% [-0.4%, -0.2%] 8

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 471.041s -> 471.157s (0.02%)
Artifact size: 386.90 MiB -> 386.90 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 29, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Nov 30, 2025

The large workspace benchmark shows improvements in not just instructions, but also time on the write dep info query.

Everything else is a mixed bag on time, unsure why other queries are affected. There are minimal improvements for incremental loading across the board. I'm guessing I'm general the branch predictor just got this all correct.

@jdonszelmann jdonszelmann force-pushed the metadata-decoding-s branch 2 times, most recently from 524ba79 to 285c9b1 Compare December 1, 2025 11:26
fn decoder(self, pos: usize) -> Self::Context;
}

impl<'a> Metadata<'a> for &'a MetadataBlob {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

importantly there are now only two, not 5 implementations of Metadata.

  • One for MetadataBlob which provides only the BlobDecodeContext which only implements BlobDecoder
  • One for (tcx, cdata) which provides the MetadataDecodeContext which does implement SpanDecoder and TyDecoder.

This makes it statically known whether we have tcx and cdata available, and whether spans etc can be decoded or not.

fn decode<'a, 'tcx, M: Metadata<'a>>(self, metadata: M) -> T::Value<'tcx>
where
T::Value<'tcx>: Decodable<DecodeContext<'a, 'tcx>>,
T::Value<'tcx>: Decodable<M::Context>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decodable specifically with the Context type from whichever kind of M: Metadata is given.

impl<'a, 'tcx> MetadataDecodeContext<'a, 'tcx> {
#[inline]
fn tcx(&self) -> TyCtxt<'tcx> {
let Some(tcx) = self.tcx else {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap removed

if let Some(alloc_decoding_session) = self.alloc_decoding_session {
alloc_decoding_session.decode_alloc_id(self)
} else {
bug!("Attempting to decode interpret::AllocId without CrateMetadata")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap removed

let cdata = self.cdata();

let Some(sess) = self.sess else {
bug!(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap removed

let local_cdata = self.cdata();

let Some(sess) = self.sess else {
bug!(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap removed

let hi = lo + len;

let Some(sess) = decoder.sess else {
bug!(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap removed

cfg_version: &'static str,
) -> Result<(), Option<String>> {
if !self.blob().starts_with(METADATA_HEADER) {
if self.blob().starts_with(b"rust") {
Copy link
Contributor Author

@jdonszelmann jdonszelmann Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these blob calls were very funny, since it gets an instance of Metadatablob... But these are methods implemented on MetadataBlob.

.decode((self, tcx))
}

fn load_proc_macro<'tcx>(self, id: DefIndex, tcx: TyCtxt<'tcx>) -> SyntaxExtension {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make things consistent, I always pass tcx first. There are one or two cases where this meant I moved the existing tcx argument.

@jdonszelmann
Copy link
Contributor Author

jdonszelmann commented Dec 1, 2025

@oli-obk I think this is ready :) Left you some review notes

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Dec 1, 2025

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

@jdonszelmann jdonszelmann changed the title Metadata decoding s Remove unwraps from metadata decoding: introduce BlobDecoder Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants